package com.adou.second.day7;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * 扑克牌
 * 1、派盒
 * 2、装牌
 * 3、洗牌
 * 4、看牌
 * 
 * @author admin
 *
 */
public class PokerDemo {

	public static void main(String[] args) {
		//1、派盒
		List<String> pokers = new ArrayList<String>();
		
		//2、装牌 ♥ ♠ ♣ ◆  ♂ ♀
		// 定义花色
		String[] colors = {"♥", "♠", " ♣", "◆"}; 
		String[] numbers = {"", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"};
		for (String color : colors) {
			for (String number : numbers) {
				pokers.add(color + number);
			}
		}
		pokers.add("♂");//大王
		pokers.add("♀");//小王
		System.out.println(pokers);
		System.out.println(pokers.size());
		
		
		// 洗牌
		System.out.println("============================洗牌=============================");
		
		Collections.shuffle(pokers);
		System.out.println(pokers);
		
		System.out.println("============================发牌=============================");
		// 玩家
		List<String> zs = new ArrayList<String>();
		List<String> ls = new ArrayList<String>();
		List<String> ww = new ArrayList<String>();
		
		// 底牌
		List<String> diPai = new ArrayList<String>();
		
		for (int i = 0; i < pokers.size(); i++) {
			String poker = pokers.get(i);
			
			if(i >= pokers.size() - 3){
				diPai.add(poker);
			} else {
				if(i % 3 == 0){
					zs.add(poker);
				} else if (i % 3 == 1){
					ls.add(poker);
				} else if (i % 3 == 2){
					ww.add(poker);
				}
			}
		}
		
		System.out.println("============================看牌=============================");
		System.out.println("============================底牌=============================");
		System.out.println(diPai);
		System.out.println(diPai.size());
		
		System.out.println("============================张三=============================");
		System.out.println(zs);
		System.out.println(zs.size());
		System.out.println("============================张三=============================");
		System.out.println(ls);
		System.out.println(ls.size());
		System.out.println("============================张三=============================");
		System.out.println(ww);
		System.out.println(ww.size());
		
		
	}

}
